From: Dan Winship Date: Fri, 18 Mar 2011 18:33:45 +0000 (-0400) Subject: appDisplay: use get_allocation_box() in _ensureIconVisible X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8573 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d0dd37fe947fd43151f2f06a7794688689ed706c;p=gnome-shell.git appDisplay: use get_allocation_box() in _ensureIconVisible When right-clicking on an AppWellIcon, the icon will become focused, which (presumably via style-changed) invalidates its current allocation, causing "icon.y" to return 0 until it has been reallocated, messing up our idea of where in the AppDisplay the icon is. Work around this by calling get_allocation_box() instead. https://bugzilla.gnome.org/show_bug.cgi?id=645162 --- diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 5017446cc..bfe5ff70a 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -86,10 +86,14 @@ AlphabeticalView.prototype = { if (vfade) offset = vfade.fade_offset; - if (icon.y < value + offset) - value = Math.max(0, icon.y - offset); - else if (icon.y + icon.height > value + pageSize - offset) - value = Math.min(upper, icon.y + icon.height + offset - pageSize); + // If this gets called as part of a right-click, the actor + // will be needs_allocation, and so "icon.y" would return 0 + let box = icon.get_allocation_box(); + + if (box.y1 < value + offset) + value = Math.max(0, box.y1 - offset); + else if (box.y2 > value + pageSize - offset) + value = Math.min(upper, box.y2 + offset - pageSize); else return;